package cn.fengwoo.springBoot.config;


import cn.fengwoo.springBoot.handle.AccessTokenVerifyInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * MVC 设置
 *
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter  {

    @Autowired
    private AccessTokenVerifyInterceptor accessTokenVerifyInterceptor; // 实例化拦截器

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(accessTokenVerifyInterceptor)
                .addPathPatterns("/user/**");
        super.addInterceptors(registry);
    }


}
